#ifndef MESSAGETYPE_H
#define MESSAGETYPE_H
#include<QString>
#include <string>
//枚举类型相比宏的优势，是可以做类型检查
enum TaskType {
    TASK_SIGNUP_SECTION1 = 1,
    TASK_SIGNUP_SECTION1_RESP_OK,
    TASK_SIGNUP_SECTION1_RESP_ERROR,
    TASK_SIGNUP_SECTION2,
    TASK_SIGNUP_SECTION2_RESP_OK,
    TASK_SIGNUP_SECTION2_RESP_ERROR,
    TASK_LOGIN_SECTION1,
    TASK_LOGIN_SECTION1_RESP_OK,
    TASK_LOGIN_SECTION1_RESP_ERROR,
    TASK_LOGIN_SECTION2,
    TASK_LOGIN_SECTION2_RESP_OK,
    TASK_LOGIN_SECTION2_RESP_ERROR,
};

struct TLV {
    int _type;
    int _length;
    char _data[1024];
public:
    void clear(){
        _type = 0;
        _length = 0;
        memset(_data,0,sizeof (_data));
    }
};
struct Packet {
    int _type;
    int _length;
    QString _msg;
public:
    Packet():
    _type(0),
    _length(0),
    _msg()
    {

    }
    Packet(const int& type ,const int& length ,const char* data):
    _type(type),
    _length(length),
    _msg(data)
    {

    }
    Packet(const TLV&tlv):
    _type(tlv._type),
    _length(tlv._length),
    _msg(tlv._data)
    {

    }
    void clear(){
        _type = 0;
        _length = 0;
        _msg.clear();
    }
};

#endif // MESSAGETYPE_H
